﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;

namespace CoolCode.UnitTest.Xunit
{
    public static class XunitExtensions
    {
        public static void IsNotNull(this object value)
        {
            Assert.NotNull(value);
        }

        public static void Equal<T>(this T value, T expected)
        {
            Assert.Equal(expected, value);
        }

        public static void Equal<T>(this IEnumerable<T> value, IEnumerable<T> expected)
        {
            Assert.Equal(expected.Count(), value.Count()); 
            for (int i = 0; i < value.Count(); i++)
                Assert.Equal(expected.ElementAt(i), value.ElementAt(i));
        }

        public static void Range<T>(this T value, T expectedMinValue, T expectedMaxValue )
        {
            Assert.InRange(value, expectedMinValue, expectedMaxValue);
        }

        public static void LessThan<T>(this T value, T expected)where T:IComparable<T>
        {
            Assert.Equal(true , value.CompareTo(expected) <0 );
        }
        
        public static void GreaterThan<T>(this T value, T expected)where T:IComparable<T>
        {
            Assert.Equal(true , value.CompareTo(expected) >0 );
        }

    }
}
